home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com
- Newsgroups: comp.lang.c++
- Subject: Re: Q: Time to call a function?
- Date: 7 Jan 1996 14:46:46 GMT
- Organization: Pipeline USA
- Message-ID: <4comcm$9fi@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 07, 1996 04:57:51 in article <Q: Time to call a function?>,
- 'ez058306@boris.ucdavis.edu (Phillip Geiger)' wrote:
-
-
- >I checked the miscellaneous section of the C-FAQ-list file but didn't see
-
- >this answered covered....
- >
- >About how much time does calling a function, allocating memory, and
- >executing simple statements like "i = 3" take? Obviously it depends
- >on how fast the computer running the program is, but I'd like a ball-park
-
- >figure for a 486 or Pentium running a simple program from DOS.
- >
- >Nanoseconds? Microseconds? Surely not as slow as a millisecond... (?)
- >
- I have a slightly old book so my figures may be out of date, but for a
- i486:
-
- Simple function call with no args:
- INSTR CLOCK CYCLES
- Call instr (Direct intersegment) 20
- Callee's push bp, etc 16
- Simple assignment 1
- Intersegment return 18
- --------------------------------------------------------------
- Total minimum 55 clock cycles
-
- You can do the arithmetic for you processor speed.
-
- For each argument passed (assuming from memory), add
- 4 clock cycles + setup time, if any; reasonably, you can
- use a total of 6 per argument on the average.
-
- (Sorry if columns don't line up as I'm using a variable pitch
- font editor.)
-
-
- >--
- >Phil Geiger
- >pggeiger@ucdavis.edu
- --
-
- Pete
-